package day3;

import java.text.DecimalFormat;
import java.util.Scanner;

public class homework {
    public static void main(String[] args) {

        //3.a
        Scanner sc = new Scanner(System.in);
        System.out.print("消费金额：");
        double money = sc.nextDouble();
        if (money * 0.8 >= 1000) {
            System.out.println("获得200百元代金券");
        }


        //3.b
        double hight=56.7;
        double luchen=0;
        int day=0;
        while(luchen<=hight){
            day=day+1;
            luchen=luchen+5;
            if(luchen>hight){
                break;
            }
            luchen=luchen-3.5;
        }
        System.out.println("大约需要" + day + "天");


        //4.a
        double moneynum = 0;
        double daymoney = 1;
        day = 0;
        while (moneynum < 10) {
            moneynum = daymoney + moneynum;
            daymoney = daymoney * 1.5;
            day = day + 1;
            System.out.println("第" + day + "天" + moneynum);
        }
        System.out.println("需要" + day + "天");


        //4.b
        moneynum = 0;
        daymoney = 1;
        int day1 = 0;
        while (day1 < 30) {
            moneynum = daymoney + moneynum;
            daymoney = daymoney * 1.5;
            day1 = day1 + 1;
        }
        DecimalFormat df = new DecimalFormat("0.00");
        String money2=df.format(moneynum);
        System.out.println("共存了" + money2 + "元");


        System.out.print("输入一个正整数：");
        int number = sc.nextInt();
        int yu;
        System.out.print(number + "=");
        for (int i = 2; i <= 8; i++) {
             yu= number%i;
            if (yu == 0) {
                System.out.print(i);
                number = number / i;
                if (number == 1) {
                    break;
                }
                System.out.print('*');
                i = 1;
            }
            if (i==8){
                System.out.println(number);
            }
        }
    }
}